﻿USE [MyTemplate]
GO
/****** Object:  StoredProcedure [dbo].[spGetArticlesPage]    Script Date: 2013-09-11 오후 8:44:45 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
create PROCEDURE [dbo].[spGetArticlesPage] 
      @PageIndex INT = 1
      ,@PageSize INT = 10
      ,@RecordCount INT OUTPUT
AS
BEGIN
      SET NOCOUNT ON;
     
      SELECT @RecordCount = COUNT(*)
      FROM tbArticles
           
      SELECT * FROM tbArticles
      WHERE ID BETWEEN
	  (@PageIndex -1) * @PageSize + 1 
	  AND
	  (((@PageIndex -1) * @PageSize + 1) + @PageSize) - 1
END
